<?php
    require_once('../../../wp-config.php');
	
	global $wpdb;
	
	if(isset($_POST['act']) && !empty($_POST['act'])){
		switch ($_POST['act']){
			case 'newsletter' :				
				if($_POST['subscription'] == 'on') {
					echo "done";
					// check user allready registered
					// --
					
					// if none
					// insert into database
//					$wpdb->query( $wpdb->prepare("
//						INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value ) VALUES ( %d, %s, %s )",10, $metakey, $metavalue 
//					));
				} elseif ($_POST['subscription'] == 'off'){
					// check user registered
					// --
					// if true
					// delete from database
//					$wpdb->query( $wpdb->prepare("
//						INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value ) VALUES ( %d, %s, %s )",10, $metakey, $metavalue 
//					));					
				} 	
			break;	
		}
	}
?>